package com.yanqu.road.server.cmd.chefduel.process2;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.chefduel.ChefDuelProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.chefduel.CrossChefDuelMgr;
import com.yanqu.road.server.protocol.Protocol;
import com.yanqu.road.utils.YanQuMessageUtils;

@Cmd(code = Protocol.C_CHEF_DUEL2_CAMP_POPULARITY, desc = "阵营人气")
public class CrossChefDuel2CampPopularityListCmd extends CrossCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        ChefDuelProto.ChefDuel2CampListReqMsg reqMsg = ChefDuelProto.ChefDuel2CampListReqMsg.parseFrom(packet.getBytes());
        ret = CrossChefDuelMgr.campPopNum(reqMsg.getActivityId(), serverId, packet.getPlayerId());

        if(ret != 0){
            MessageHelper.sendPacket(serverId, packet.getPlayerId(), YanQuMessageUtils.buildMessage(Protocol.U_CHEF_DUEL2_CAMP_POPULARITY, ChefDuelProto.ChefDuel2CampListRespMsg.newBuilder().setRet(ret)));
        }
    }

    @Override
    public void sendData() {

    }
}
